<?php
class ServicoController extends AppController {
    public $scaffold;

    public function delete($coServico, $cdInstLab) {
        try{
            $dataSource = $this->Servico->getDataSource();
            $dataSource->begin();
            $retorno['RETORNO'] = 'false';

            //$retorn = $this->Servico->query("DELETE FROM RL_RESP_INSTITUICAO_SERVICO WHERE CO_SERVICO = " . $coServico . " AND CD_INST_LAB = " . $cdInstLab . " ");
            $retorn = $this->Servico->query("DELETE FROM RL_SERVICO_INST_LAB WHERE CO_SERVICO = " . $coServico . " AND CD_INST_LAB = " . $cdInstLab . " ");
            if ($retorn) {
                $retorno['RETORNO'] = 'true';
                $dataSource->commit();
            }
        }catch (Exception $e){
            $dataSource->rollback();
            $retorno['RETORNO'] = 'false';
        }
        print json_encode($retorno);exit;
    }
}
?>